
(map bit-set? 
     '(1 0 3 1000000 2 0)
     '(1 1 10 -1 6 6))			; => (#f #t #t #t #t #f)

(map integer-length  '(0 1 -1 7 -7 8 -8)) ; => (1 0 3 3 4 3)

(map first-set-bit 
     (list 1 2 0 40 -28 (expt  2 99) (expt  -2 99))) ; => (0 1 #f 3 2 99 99)

;; Collect statistics.  The variable 'n' is the number of reschedules,
;; and `t' is the interoffset time.  Prints timing data at end of
;; expression.

(in-mthread
 (let ((n 200)
       (t 0.01)
       (begin-time (utc)))
   (let loop ((i 0))
     (if (< i n)
	 (begin 
	   (if (= (modulo i 100) 0)
	       (inform "i/n:" i n))
	   (thread-sleep! t)
	   (loop (+ i 1)))))
   (let* ((end-time (utc))
	  (elapsed-time (- end-time begin-time))
	  (sleep-time (* n t))
	  (interpreter-use (/ (- elapsed-time sleep-time) n)))
     (inform "Requested sleep (seconds): " sleep-time)
     (inform "Elapsed time    (seconds):" elapsed-time)
     (inform "Intepreter use  (seconds):" interpreter-use))))

;; SRFI-34

(with-exception-handler
 (lambda (msg) 
   (display msg)
   (newline))
 (lambda () 
   (/ 5 0)))

;; => ERROR W/DISPLAY

(with-exception-handler
 (lambda (msg) 
   (display msg)
   (newline))
  (lambda () 
   (error "error string:" 'scheme-value))) 

;; => ERROR W/DISPLAY
